<template>
  <div class="topcard">
    <router-link class="topcard-wrap" :to="CPNhref">
      <div class="top-sign" :style="{'background':CPNcolor}">
        <span class="top-sign-bd"><slot name="bd-label"></slot></span>
        <div class="mask">
          <div class="small"><slot name="s-label"></slot></div>
          <div class="large"><slot name="l-label"></slot></div>
        </div>
      </div>
      <div class="top3" :style="{'background':`url(${CPNimgurl}) center center / cover no-repeat`}">
        <div class="mask">
          <div v-for="(item,index) in data" :key="index"><div class="van-ellipsis top3-name">{{index+1}}.{{item.book}}</div><span>{{item.grade}}</span></div>
        </div>
      </div>
    </router-link>
  </div>
</template>

<script>
export default {
  props:{
    CPNimgurl:String,
    CPNhref:String,
    CPNcolor:{
      type:String,
      default:'rgb(74, 68, 76)'
    },
    data:Array
  }
}
</script>

<style>
  .topcard{  
    padding: 0 15px;
    margin-bottom: 12px;
  }
  .topcard-wrap{
    display: flex;
    height: 100px;
  }
  .top-sign{
    flex: 100px 0 0;
    border-radius: 4px 0 0 4px;
    overflow: hidden;
  }
  .top-sign-bd{
    font-size: 28px;
    opacity: .1;
    color: hsla(0,0%,100%,.9);
  }
  .top-sign,.top3{
    line-height: 100px;
    text-align: center;
    position: relative;
  }
  .top3{
    flex:1;
    border-radius: 0 4px 4px 0;
  }
  .mask{
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    line-height: 1.4;
    font-size: 13px;
    color: #fff;
  }
  .top-sign .mask{
    background: rgba(0, 0, 0,0);
  }
  .top3 .mask{
    border-radius: 0 4px 4px 0;
    background: rgba(74, 68, 76,.8);
    text-align: left;
  }
  .mask .small{
    color: hsla(0,0%,100%,.6);
    font-size: 13px;
  }
  .mask .large{
    font-size: 17px;
    color: hsla(0,0%,100%,.9);
  }
 .top3 .top3-name{
    display: inline-block;
    vertical-align: text-bottom;
    text-indent: 15px;
    max-width: 180px;
 }
 .top3-name+span{
    display: inline-block;
    vertical-align: text-bottom;
    text-indent: 6px;
    font-size: 12px;
    color: #ffac2d;
  }
</style>